cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES CXX)

add_executable(${PROJECT_NAME} test_package.cpp)

set(SFML_COMPONENTS system)
set(SFML_TARGETS sfml-system)
if(SFML_WITH_WINDOW)
    target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_WINDOW)
    list(APPEND SFML_COMPONENTS window)
    list(APPEND SFML_TARGETS sfml-window)
endif()
if(SFML_WITH_GRAPHICS)
    target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_GRAPHICS)
    list(APPEND SFML_COMPONENTS graphics)
    list(APPEND SFML_TARGETS sfml-graphics)
endif()
if(SFML_WITH_NETWORK)
    target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_NETWORK)
    list(APPEND SFML_COMPONENTS network)
    list(APPEND SFML_TARGETS sfml-network)
endif()
if(SFML_WITH_AUDIO)
    target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_AUDIO)
    list(APPEND SFML_COMPONENTS audio)
    list(APPEND SFML_TARGETS sfml-audio)
endif()

find_package(SFML REQUIRED ${SFML_COMPONENTS} CONFIG)
target_link_libraries(${PROJECT_NAME} PRIVATE ${SFML_TARGETS})
